<div class="row">
	<form class="form-inline" method="post" action="?action=add">
		<div class="form-group">
			<label class="sr-only" for="os_name">Tên hệ đều hành</label> <select
				class="form-control" id="os_id" name="os_id">
			 <?php foreach ($this->os as $item ){?>
				<option value="<?php echo $item['os_id']?>"><?php echo $item['os_name']?></option>
			<?php }?>	
			</select>
		</div>
		<div class="form-group">
			<label class="sr-only" for="cp_name">Tên thiết bị</label> <input
				type="text" class="form-control" id="cp_name" name="cp_name"
				placeholder="Tên thiết bị">
		</div>
		<div class="form-group">
			<label class="sr-only" for="os_status">Trạng thái</label> <select
				class="form-control" id="cp_status" name="cp_status">
				<option value="1">Kích hoạt</option>
				<option value="0">Không kích hoạt</option>

			</select>
		</div>
		<button type="submit" id="add-os-1" class="btn btn-success">Thêm</button>
	</form>
	<div id="message"></div>
</div>
<div class="row">
	<form method="post" action="?action=delete">
		<table class="table">
			<thead>
				<tr>
					<th>#</th>
					<th>Hệ đều hành</th>
					<th>Thiết bị</th>
					<th>Trạng thái</th>
					<th>Action</th>
				</tr>
			</thead>
			<tbody id="resultData">
            <?php $i=0; foreach ($this->data as $item ){ ?>
            <tr>
					<td class="cp_id" data-cpid="<?php echo $item['cp_id']?>"><?php echo $i=$i+1;?></td>
					<td class="os_id" data-id="<?php echo $item['os_id']?>"><?php echo $item['os_name']?></td>
					<td class="cp_name"><?php echo $item['cp_name']?></td>
					<td class="cp_status" data-status ="<?php echo $item['cp_status']?>">
					   <?php echo $item['cp_status']?>
					</td>
					<td>
						<button type="submit" value="<?php echo $item['cp_id']?>"
							name="cp_id">
							<i class="fa fa-times-circle"></i>
						</button>
						<button type="button" value="<?php echo $item['cp_id']?>"
							class="cp_edit">
							<i class="fa fa-pencil"></i>
						</button>
					</td>
				</tr>    
            <?php }?>
            
        </tbody>

		</table>
	</form>


	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<form class="form-horizontal" method="post" action="?action=edit">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal"
							aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title" id="myModalLabel">Chi tiết phiên bản</h4>
					</div>
					<div class="modal-body">
						<div class="form-group">
							<label for="os_id_edit" class="col-sm-3 control-label">Hệ đều hành</label>
							<div class="col-sm-9">
							    <input type="hidden" id="cp_id_edit" name="cp_id_edit"> 
								<select	class="form-control" id="os_id_edit" name="os_id_edit">
                    			 <?php foreach ($this->os as $item ){?>
                    				<option value="<?php echo $item['os_id']?>"><?php echo $item['os_name']?></option>
                    			<?php }?>	
                    			</select>
							</div>
						</div>
						<div class="form-group">
							<label for="cp_name_edit" class="col-sm-3 control-label">Phiên bản</label>
							<div class="col-sm-9">
								<input type="text" class="form-control" id="cp_name_edit" name="cp_name_edit" placeholder="Phiên bản">
							</div>
						</div>
						<div class="form-group">
							<label for="cp_status_edit" class="col-sm-3 control-label">Trạng thái</label>
							<div class="col-sm-9">
								<select	class="form-control" id="cp_status_edit" name="cp_status_edit">
                    				<option value="1">Kích hoạt</option>
                    				<option value="0">Không kích hoạt</option>
                    			</select>
							</div>
						</div>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="submit" class="btn btn-primary">Save changes</button>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>